package base.httpclient;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;

import java.io.IOException;

/**
 * Created by majian8 on 2019/6/14.
 */
public class MyThread implements Runnable{
    private HttpClient client;
    private HttpGet httpGet;

    public MyThread(HttpClient client, HttpGet httpGet) {
        this.client = client;
        this.httpGet = httpGet;
    }

    @Override
    public void run() {
        System.out.println(httpGet.getURI().toString());
        try {
            HttpResponse response= client.execute(httpGet);
            HttpEntity entity=response.getEntity();
            //System.out.println(EntityUtils.toString(entity));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
